<template>
<div>
  <ul>
    <li><span>姓名: </span><input v-model="name" type="text"></li>
    <li><span>年龄: </span><input v-model="age"  type="text"></li>
    <li><span>身高: </span><input v-model="sgao"  type="text">(米)</li>
    <li><span>体重: </span><input v-model="tzhong"  type="text">(公斤)</li>
    <li><span>病史: </span><input v-model="bshi"  type="text"></li>
    <li><button @click="zd()">诊断</button></li>
    <li v-show="iss"><p>患者 {{this.name}} 的诊断结果: {{ cc() }}</p></li>
  </ul>
</div>
</template>

<script>
export default {
  data () {
    return {
      name:'',
      age:'',
      sgao:'',
      tzhong:'',
      bshi:'',
      jg:'',
      iss:false
    }
	},
    methods: {
    zd(){
      this.jg= this.tzhong/(this.sgao*this.sgao)
      this.iss=true
    },
    cc(){
      if(this.jg<=18.5){
        return '体重过轻'
      }
      if(18.5<this.jg<=24.9){
          return '正常' 
      }
      if(24.9 < this.jg <= 29.9){
          return '体重过重' 
      }
      if(this.jg> 29.9){
          return '肥胖' 
      }

    
    }
	},
  components:{
    
  }
}
</script>

<style>
ul{
  list-style: none;
}
</style>
